<?php
namespace Model;

use Zend\Db\Adapter\Adapter;
use Zend\Db\ResultSet\ResultSet;
use Zend\InputFilter\InputFilter;

class AlbumTable extends AbstractTable
{

    public function getAlbum($id){
       return $this->getById($id);
    }

    public function getAllAlbum(){
        $sql = $this->getTableGateway()->getSql();
        $select = $sql->select()->join( 'user', 'user.id = album.created_by', array('username' => 'user_name'));
        $statement = $sql->prepareStatementForSqlObject($select);
        $resultSetPrototype = new ResultSet();
        $resultSetPrototype->setArrayObjectPrototype(new Album());
        $resultInterface = $statement->execute();
        $resultSetPrototype->initialize($resultInterface);
        return $resultInterface;
    }

    /**
     * @return InputFilter
     */
    public function getInputFilter()
    {
       return new InputFilter();
    }
}